//
//  DownloadUploadViewController.m
//  eBook
//
//  Created by Dimaginexus on 14-5-15.
//  Copyright (c) 2014年 zhan. All rights reserved.
//

#import "DownloadUploadViewController.h"

@interface DownloadUploadViewController ()

@end

@implementation DownloadUploadViewController

@synthesize DUVCDelegate;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma mark - tableView delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"DUCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    
    UILabel *typeLabel = (UILabel *)[cell viewWithTag:100];
    UILabel *contentLabel = (UILabel *)[cell viewWithTag:101];
    UILabel *timeLabel = (UILabel *)[cell viewWithTag:102];
    
    switch (indexPath.row)
    {
        case 0:
            typeLabel.text = @"Video";
            contentLabel.text = @"答辩注意事项";
            timeLabel.text = @"2014年3月2日";
            break;
        case 1:
            typeLabel.text = @"PPT";
            contentLabel.text = @"SPSS的使用方法";
            timeLabel.text = @"2014年3月2日";
            break;
        case 2:
            typeLabel.text = @"PIC";
            contentLabel.text = @"问卷星使用指南";
            timeLabel.text = @"2014年3月2日";
            break;
        default:
            break;
    }
    
    return cell;
}

-(BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return NO;
}

#pragma actions

- (IBAction)dismissVC:(id)sender
{
    [XAppDelegate.stackVC popViewControllerAnimated:YES];
    [DUVCDelegate dUVCBackToMenu];
}

- (IBAction)addDUItem:(id)sender
{
    [SVProgressHUD showWithStatus:[NSString stringWithFormat:@"正在%@", self.duString]];
    dispatch_queue_t newThread = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(newThread, ^{
        sleep(2);
        [SVProgressHUD dismissWithSuccess:[NSString stringWithFormat:@"%@成功", self.duString]];
    });
}



@end
